{% extends 'ShopAdminBundle::my_form_add.html.twig'%}
{% set _module='后台用户' %}

{% if is_edit is defined %}
    {% set _current='编辑用户'%}
{% else %}
    {% set _current='添加用户' %}
{% endif %}


{% block form_groups %}
    {% include 'ShopAdminBundle:AdminUser:form.html.twig' %}
{% endblock %}

{% block plugin_js %}
<script>
    $('#btn_submit_form').on('click',function(){

        var fm=$(this).parents('form');

        var entity=wxi.shopBundle.
                preCheckForm(fm, 'shop_adminbundle_adminuser');


//        console.log(entity);

        if(!entity.username){
            wxi.util.tipMsg('', '请填写用户名');
            return false;
        }

        if(fm.attr('action') == '/admin/adminuser' && !entity.password){
            wxi.util.tipMsg('', '请填写密码');
            return false;
        }

        if(entity.roleId == 0){
            wxi.util.tipMsg('', '请选择权限组');
            return false;
        }

        fm.submit();

    });
</script>

{% endblock %}